﻿@model WebSoftSeo.Models.Contact
@{
    ViewBag.Title = "Contact";
}
<div class="wrapfilterbgContact">
    <div class="container">
        <div class="wrapfilter2">
            <div class="divfilterL">
                <h1 class="h1title">Contact us</h1>
                <h2>Please sign-up for our newsletter to get notified!</h2>
                <p>Duis tempor rhoncus quam, at blandit nulla egestas vitae. Morbi ut turpis nunc, risus dictum tempor luctus, quam augue blandit sapien. </p>
            </div>
            <div class="divfilterR">
                <div class="formSub">
                    <button type="button" class="buttonSub">Submit</button>
                    <input type="text" class="testBoxsub" placeholder="Adress Email">
                </div>
            </div>
            <div class="clearfix"></div>
        </div>
    </div>
</div>
<!-- Content Blog -->
<div class="wrapBlogContent">
    <div class="container">
        <div class="divMap">
            <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d979.7727585427353!2d106.6396675819905!3d10.804339493685362!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x3175295abefcaf4d%3A0xa32041fbf4ae51b8!2zMzkgTmjhuqV0IENoaSBNYWksIDEzLCBUw6JuIELDrG5oLCBI4buTIENow60gTWluaCwgVmnhu4d0IE5hbQ!5e0!3m2!1svi!2s!4v1388142876526" width="1200" height="600" frameborder="0"; style="border:0"></iframe>
        </div>
        <div class="wrapContact">
            @Html.Partial("_ContactInfo")
            @using (Html.BeginForm("FormContact", "Contact", FormMethod.Post, new { enctype = "multipart/form-data", id = "ContactForm" }))
            {
                <div class="divContactR">
                    <h1 class="titleContact">Liên lạc</h1>
                    <div class="formContact">
                        <ul>
                            <li>
                                <label>Name</label>
                                <div class="testboxC">
                                    @*<input class="validation-failed"; placeholder="Name" @Html.TextBoxFor(m => m.Name, new { @class = "cssName" }) />*@
                                    @Html.TextBoxFor(m => m.Name, new { id = "NameContact", @placeholder="Name"})
                                    <p id="NameContact1" class="required"></p>
                                    <div class="clearfix"></div>
                                </div>
                            </li>
                            <li>
                                <label>Email</label>
                                <div class="testboxC">
                                    @Html.TextBoxFor(m => m.Email, new { id = "EmailContact", @placeholder="Email"})
                                    <p class="required" ; id="EmailContact1"></p>
                                    <div class="clearfix"></div>
                                </div>
                            </li>
                            <li>
                                <label>Subject</label>
                                <div class="testboxC">
                                     @Html.TextBoxFor(m => m.Subject, new { id = "Subject", @placeholder="Subject"})
                                    <p class="required" ; id="Subject1"></p>
                                    <div class="clearfix"></div>
                                </div>
                            </li>
                            <li>
                                <label>Message</label>
                                <div class="testboxC">
                                     @Html.TextAreaFor(m => m.Message, new { id = "Message", @placeholder="Message"})
                                     <p class="required" ; id="Message1"></p>
                                    <div class="clearfix"></div>
                                </div>
                            </li>
                        </ul>
                        <button type="submit" class="button">Send</button>
                    </div>
                </div>
            }
            <div class="clearfix"></div>
        </div>
        <div class="clearfix"></div>
    </div>
</div>
<script type="text/javascript">

    function ValidateContact() {
        var NameContact = $("#NameContact").val();
        var EmailContact = $("#EmailContact").val();
        var Subject = $("#Subject").val();
        var Message = $("#Message").val();
        if (NameContact == "" || EmailContact == "" || Subject == "" || Message == "") {
            if (NameContact == "") {
                $("#NameContact1").html("Vui lòng nhập tên");
                $("#NameContact").addClass("validation-failed");
                $("#NameContact").focus();

            }
            if (EmailContact == "") {
                $("#EmailContact1").html("Vui lòng nhập Email");
                $("#EmailContact").addClass("validation-failed");
                $("#EmailContact").focus();

            }
            if (Subject == "") {
                $("#Subject1").html("Vui lòng nhập tiêu đề");
                $("#Subject").addClass("validation-failed");
                $("#Subject").focus();
            }
            if (Message == "") {
                $("#Message1").html("Vui lòng nhập nội dung");
                $("#Message").addClass("validation-failed");
                $("#Message").focus();
            }
            return false;
        }
        if (!isValidEmailAddress(EmailContact)) {
            $("#EmailContact1").html("Email không hợp lệ");
            $("#EmailContact").addClass("validation-failed");
            $("#EmailContact").focus();
            return false;
        }
        return true;
    }
</script>
<script type="text/javascript">
    function isValidEmailAddress(EmailContact) {
        var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
        return pattern.test(EmailContact);
    }
</script>
<script type="text/javascript">
    $("#NameContact").blur(function () {
        var name = $('#NameContact').val();
        if (name != "") {
            document.getElementById("NameContact1").innerHTML = "";
            $("#NameContact").removeClass("validation-failed")
        }
    });
</script>
<script type="text/javascript">
    $("#EmailContact").blur(function () {
        var name = $('#EmailContact').val();
        if (name != "") {
            document.getElementById("EmailContact1").innerHTML = "";
            $("#EmailContact").removeClass("validation-failed")
        }
    });
</script>
<script type="text/javascript">
    $("#Subject").blur(function () {
        var name = $('#Subject').val();
        if (name != "") {
            document.getElementById("Subject1").innerHTML = "";
            $("#Subject").removeClass("validation-failed")
        }
    });
</script>
<script type="text/javascript">
    $("#Message").blur(function () {
        var name = $('#Message').val();
        if (name != "") {
            document.getElementById("Message1").innerHTML = "";
            $("#Message").removeClass("validation-failed")
        }
    });
</script>
<script type="text/javascript">
    $('#ContactForm').submit(function () {

        return ValidateContact();

    });
</script>
